<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" trimDirectiveWhitespaces="true"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>借货信息管理</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/style/style.css" />
    <link rel="stylesheet" href="${pageContext.request.contextPath}/style/appAdmin/bootstrap.css" />
	<link rel="stylesheet" href="${pageContext.request.contextPath}/style/appAdmin/bootstrap-responsive.css" />
	
	<script language="javascript" src="${pageContext.request.contextPath}/tool/jquery/jquery.min.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/js/public.js"></script>
	<script language="javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
	<script type="text/javascript">
	$(function(){
			//日期控件
			//$("#jdDate").date_input();
			//绑定自动格式化输入日期
			$("#jdDate").keydown(function(e){
				//alert("cc"+e.keyCode);
				if(e.keyCode==13){//回车操作，使输入日期变为统一格式
					//alert(writeDate($(this).val()));
					$("#jdDate").val(writeDateFormat($(this).val()));
				}
			});
			
		})
		
	var beforeSubmit = function(){
		//验证
		if($("#jdDate").val()==""){
			alert("请输入日期");
			return;
		}
		//if($("#jdAmountJie").val()=="" && $("#jdAmountDai").val()==""){
			//alert("请输入借货金额");
			//return;
		//}
		if($("#jdDesc").val()==""){
			alert("请输入摘要");
			return;
		}
		//日期格式化
		$("#jdDate").val(writeDateFormat($("#jdDate").val()));
		$("#form_jiedai").submit();
	}
	
	//全部删除
	var removeAllData = function(){
		$.get("${pageContext.request.contextPath}/jiedai/removeAll.action",function(data){
			//alert(data);
			location.reload();
		})
	}
	</script>
</head>
<body>
<div class="mCon">
<form action="${pageContext.request.contextPath}/jiedai/do_save.action" method="post" id="form_jiedai" class="form-horizontal well">
  <input type="hidden" name="id" id="id" value="${empty baseinfo ? 0 : baseinfo.id}" />
   
   <table class="offset1">
   <tr>
   	<th class="span2">日期<font color="red">*</font>:</th>
    <td class="span3"> <input type="text" name="jdDate" id="jdDate" value="${baseinfo.jdDate}" /></td>
    <th class="span2">凭证字号:</th>
    <td class="span3"> <input type="text" name="jdKey" id="jdKey" value="${baseinfo.jdKey}" /></td>
    <th class="span2">业务编号:</th>
    <td class="span3"> <input type="text" name="jdCode" id="jdCode" value="${baseinfo.jdCode}" /></td>
   </tr>
   <tr>
    <th class="span2">借方本位币金额:</th>
    <td class="span3"> <input type="text" name="jdAmountJie" id="jdAmountJie" value="${baseinfo.jdAmountJie}" /></td>
    <th class="span2">货方本位币金额:</th>
    <td class="span3"> <input type="text" name="jdAmountDai" id="jdAmountDai" value="${baseinfo.jdAmountDai}" /></td>
    <th class="span2">上年结转金额:</th>
    <td class="span3"> <input type="text" name="jdAmountJiezhuan" id="jdAmountJiezhuan" value="${baseinfo.jdAmountJiezhuan}" /></td>
   </tr>
   <tr>
    <th class="span2">摘要<font color="red">*</font>:</th>
    <td class="span3" colspan="5"> <input type="text" name="jdDesc" id="jdDesc" style="width:560px;" value="${baseinfo.jdDesc}" /></td>
   </tr>
   </table>
   
   <p class="scxz" align="center">
      <input class="mCon_btn2" type="button" onclick="beforeSubmit();" value="保 存" />
      &nbsp;&nbsp;&nbsp;&nbsp;
      <a class="mCon_2a" href="${pageContext.request.contextPath}/maintain/jiedai/import_excel.jsp" target="_blank">从Excel导入</a>
      &nbsp;&nbsp;&nbsp;&nbsp;
      <a class="mCon_2a"  href="${pageContext.request.contextPath}/jiedai/to_count.action" target="_blank">统计</a>
      &nbsp;&nbsp;&nbsp;&nbsp;
      <a class="mCon_2a"  href="${pageContext.request.contextPath}/jiedai/exportDataToExcel.action?fileName=data">导出到excel</a>
      &nbsp;&nbsp;&nbsp;&nbsp;
      <a class="mCon_2a"  href="javascript:removeAllData();">全部删除</a>
      &nbsp;&nbsp;&nbsp;&nbsp;
      <a class="mCon_2a"  href="http://www.su10m.com/project/jkl/help/jiedai/index.html" target="_blank">系统说明</a>
  </p>
  </form>
  
<div class="main_list">
      <table class="table table-bordered table-hover table-striped">
        <tr class="main_title main_title2">
          <td>日期</td>
          <td>凭证字号</td>
          <td>摘要</td>
          <td>业务编号</td>
          <td>借方本位币金额</td>
          
          <td>贷方本位币金额</td>
          <td>余额方向</td>
          <td>本位币余额</td>
          <td>操作</td>

        </tr>
        <c:if test="${empty list}">
        <tr><td colspan="9" align="center">暂无数据！</td></tr>
        </c:if>
        <c:if test="${!empty list}">
        <c:forEach items="${list}" var="one">
        
        <tr class="main_td">
          
          <td>${one.jdDate}</td>
          <td>${one.jdKey}</td>
          <td>${one.jdDesc}</td>
          <td>${one.jdCode}</td>
          <td><fmt:formatNumber pattern="0.0">${one.jdAmountJie}</fmt:formatNumber></td>
          <td><fmt:formatNumber pattern="0.0">${one.jdAmountDai}</fmt:formatNumber></td>
          <td>${one.jdTypeStr}</td>
          <td><fmt:formatNumber pattern="0.0">${one.jdBalance}</fmt:formatNumber></td>
          <td>
          	<a title="修改" href="${pageContext.request.contextPath}/jiedai/index.action?jdId=${one.id}"><img class="admin_sq" src="${pageContext.request.contextPath}/images/b_edit.png" /></a>
          	<a title="删除" href="${pageContext.request.contextPath}/jiedai/destroy.action?jdId=${one.id}"><img class="admin_sq" src="${pageContext.request.contextPath}/images/b_drop.png" /></a>
          </td>

        </tr>
        </c:forEach>
        </c:if>
        
      </table>
    </div>
    </div>
</body>
</html>